<!--
 * @Description: 未登录状态头部组件
-->
<template>
  <div class="header-no-login">
    <div class="calendar-section">
      <div class="date-list">
        <div 
          v-for="(item, index) in riliList" 
          :key="item.key"
          :class="['date-item', { active: item.checked }]"
          @click="handleDateClick(index, item)"
        >
          <div class="weekday">{{ item.weekday }}</div>
          <div class="date">{{ item.value }}</div>
        </div>
      </div>
      <el-button class="more-btn" @click="handleScheduleClick">更多</el-button>
    </div>
  </div>
</template>

<script setup lang="ts">
interface Props {
  riliList: any[]
}

const props = defineProps<Props>()

const emit = defineEmits<{
  onSchedule: []
  onCalendarDay: [{ index: number; time: string }]
}>()

const handleDateClick = (index: number, item: any) => {
  emit('onCalendarDay', { index, time: item.key })
}

const handleScheduleClick = () => {
  emit('onSchedule')
}
</script>

<style scoped lang="less">
.header-no-login {
  background: #fff;
  border-radius: 12px;
  margin: 0 16px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.calendar-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.date-list {
  display: flex;
  gap: 8px;
  flex: 1;
}

.date-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  
  &.active {
    background-color: #409eff;
    color: #fff;
  }
  
  &:hover:not(.active) {
    background-color: #f5f7fa;
  }
  
  .weekday {
    font-size: 12px;
    margin-bottom: 4px;
  }
  
  .date {
    font-size: 14px;
    font-weight: 500;
  }
}

.more-btn {
  margin-left: 16px;
}
</style>
